<template>
  <div>test3</div>
</template>

<script>
export default {
  methods: {
    handleKeyDown(event) {
      if (event.key === "+") {
        this.openDialog();
      } else if (event.key === "Enter") {
        this.confirm();
      }
    },
    openDialog() {
      // this.$refs.dialog.open(); // 假设你的对话框是通过 ref 引用的
      console.log("打开");
    },
    confirm() {
      // this.$refs.dialog.confirm(); // 假设你的对话框有一个 confirm 方法
      console.log("确定");
    },
  },

  mounted() {
    window.addEventListener("keydown", this.handleKeyDown);
  },

  beforeDestroy() {
    window.removeEventListener("keydown", this.handleKeyDown);
  },
};
</script>

<style scoped></style>
